package com.example.initmethoddemo;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.StreamUtils;

import java.util.Scanner;

/**
 * @Description: 算法得案例德莫
 * @author: LiuYC
 * @date: 2021年04月23日 14:21
 */
public class StringsDemo {
    public static void main(String[] args) {
        String[] names = {"张三", "李四", "王二麻子", "赵六", "小明"};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name = sc.nextLine();
        boolean flag = false;
        for (int i = 0; i < names.length; i++) {
            if (name.equals(names[i])) {
//            if (StringUtils.equals(names[i], name)) {
                flag = true;
                break;
            }
        }
        if (flag) {
            System.out.println("你输入的名字存在：" + name);
        } else {
            System.out.println("你输入的名字没有：" + name);
        }

    }
}
